\documentclass[12pt]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{hyperref}

%http://tex.stackexchange.com/questions/43743/how-to-reduce-line-space-leading-within-an-enumerate-environment
%\usepackage{paralist}
\usepackage{lipsum}
\usepackage{enumitem}
%\setlist[enumerate]{itemsep=27mm}
%\setlist{noitemsep}
\setenumerate[0]{label=(\alph*)}
\setlist{itemsep=0.5mm}


\begin{document}
%\pagenumbering{gobble}

\large{Name:} \hfill    \large{Probability for Scientists, Fall 2013}

\large{Collaborator(s):} \hfill    \large{ Bio 409 / Bio 509 / Stat 479 } 

\hfill    \large{ Lab 2 (95 pts), Due 10 Sep 2013 }

~\\
\textbf{Answer Key:  5 points extra credit for each non-trivial error/correction, to a max of 10 points.  Please send corrections via email to probforsci@x14n.org as soon
as you find them, with email subject: Correction.
~\\~\\
Rewrite questions are denoted with @@.  A rewrite can earn you up to 50\% of the
points that you missed.
} 
~\\
~\\
\textbf{Please show your work, and leave answers as fractions when applicable.
Approximations are permitted, provided justification is included. Attach extra
paper as needed.}

\section{(20) Craps}
Craps is a betting game where 2 6-sided dice are tossed.  
A toss of 7 or 11 results in an immediate win, and a toss of 2, 3, or
13 results in an immediate loss.  
\begin{enumerate}
    \item What is the probability of neither winning nor losing on a single
toss?

\textbf{ First we need to find the probability of either winning (7
or 11) or losing (2, 3, or 12).  Thus we have:
~\\
~\\
Pr(7 or 11 or 2 or 3 or 12)
~\\
= 6/36 + 2/36 + 1/36 + 2/36 + 1/36)
~\\
= 12/36 = 1/3.
~\\
~\\
But we want the probability of {\em not} winning or losing:
~\\
Pr(not (winning or losing)) = 1 - Pr(winning or losing) = 1 - 1/3 = 2/3
~\\
~\\
@@ Lab Redo Question: Explain why the probability is {\em not} (1-5/11 = 6/11),
e.g. the number of possible rolls (2 through 12: 11 total) divided by the number of possible options
(roll equals 4, 5, 6, 8, 9, 10: 6 total).
~\\
~\\
As many of you noticed, 13 is
impossible, and was a technical error (5 points extra credit for pointing out
this was an error). If you used Pr(13) = 0, then the correct answer is
25/36.
}

    \item What would this probability be if craps were played with 3 4-sided
dice?

\textbf{
As above, we have:
1 - Pr(7~or~11~or~2~or~3~or~12). Here, the total sample space is \boldmath{$4^3 = 64$}.
~\\~\\
First, find all the possible combinations of 3 dice that can yield these
numbers, and then find the number of different ways to get those 3 dice (shown in
parentheses). 
~\\~\\
7: 1+3+3 (3), 1+2+4 (6), and 2+2+3 (3) = 12 total
~\\
11: 3+4+4 (3) 
~\\
2: Not possible
~\\
3: 1+1+1 (1)
~\\
12: 4+4+4 (1)
~\\~\\
Thus, 
~\\
1 - Pr(7 or 11 or 2 or 3 or 12)
~\\
= 1 - Pr(12/64 +3/64 + 0 + 1/64 +1/64)
~\\
= 1 - 17/64 = 47/64
~\\~\\
If you used 13, then the correct answer is 48/64 = 3/4.
}
\end{enumerate}
~\\
~\\
~\\
~\\
~\\

\section{(20) Blackjack}
Blackjack is a betting game played with a standard deck of cards, where the goal
is to get 21 points.  Each card has
a point value: 4 cards = 11 points (Aces), 16 cards = 10 points (10s and face
cards), and 32 other numbered cards.  
\begin{enumerate}
    \item What is the probability that 2 cards drawn
from a full, well-shuffled deck add to 21?
~\\
\textbf{
There are several ways to approach this.  We don't really care about the order of
cards, so the total sample space is \boldmath{$52 \choose 2$}= (52!)/(50!*2!) =
(52*51)/2 = 1326.  This is correct, but makes finding the number of hands a
little tricky.
~\\
Alternately, you can think of all hands being unique (order is important).
There are 52 ways to draw the first card, and 51 ways to draw the seconds, and
thus 52*51 = 2652 unique hands. This is what most people did. 
~\\
~\\
We want the probability of getting 21:
~\\
Pr(21) = Pr((10 and 11) or (11 and 10))
~\\
= (16/52*5/51) + (4/52*16/51)
~\\
= (64/2652) + (64/2652) = 128/2652
}
    \item What proportion of the sample space of 2-card hands scores 20 or more
points?
~\\
\textbf{ There are several different interpretations of this problem (9 + Ace,
Ace + Ace).  Full credit was given for any reasonable answer.
~\\ 
~\\ 
As above, total hands (ordered): 52*51 = 2652
~\\
We want \boldmath{$Pr(\ge 20)$} = Pr(20) + Pr(21) + Pr(22).
~\\
~\\
We solved for Pr(21) above.
~\\
Pr(20) =  
~\\
~[Pair of Ten Cards] (16/52 * 15/51) +
~\\
~  [Nine + Ace] (4/52 * 4/51)  +
~\\
~  [Ace + Nine] (4/52 * 4/51)
~\\
  = 272/2652.
~\\
  Pr(22) =  [Pair of Aces] (4/52 * 3/51) = 12/2652.
~\\
~\\
So, Pr(20) + Pr(21) + Pr(22) = (128 + 272 + 12)/2652 = 412/2652.
}

\end{enumerate}

\clearpage
\textbf{Probability and information encoding are deeply intertwined topics.  In this
section, we will focus on DNA, which biological systems use 
to encode information.  DNA contains 4 different bases (A, T, G, and C), and is
double-stranded: the 2 strands complement each other (A matches with T
and C matches with G).  Thus, the two strands are completely dependent on each
other, with 4 possible choices at each position.}



\section{(15) Primers}
PCR is a technique used to amplify (make many copies of) DNA.  PCR requires short
stretches of DNA that complement regions of the target DNA.  How many possible unique primers are there
of the following lengths?
~\\ 
~\\ 
\textbf{
In general, the number of possible combinations of N objects, each object having
M possible options, is \boldmath{$M^N$}.  In this case, each base has 4 possible
options. Thus:
~\\ 
~\\ 
}
\begin{enumerate}
    \item 5 \hfill \boldmath{$4^5$}
    \item 10 \hfill \boldmath{$4^{10}$}
    \item 20 \hfill \boldmath{$4^{20}$}
\end{enumerate}
 
\section{(15) Genomes}
The rabies virus has a genome that contains approximately 12,000 bases.  

\begin{enumerate}
    \item How many unique sequences of 12,000 bases are theoretically possible?
~\\ \hfill \boldmath{$4^{12,000}$}
    \item Why might all of these sequences not be practically possible?  What
forces constrain genomes?
~\\ \hfill \textbf{Evolution, CG proportions, secondary structure...}
\end{enumerate}
 
\section{(30) Primers + Genomes}
I give you randomly-selected primers of the following sizes, as well as a
sample of rabies virus.
Assuming the rabies virus genome is random (which it isn't!), what is the
probability that each primer perfectly matches the virus sample at least once?
(Hint: what is the probability that the sequence HTTH is *not* found in 10
random coin flips?)

\textbf{
This is a common but difficult problem, often referred to as the ``at least one''
problem.  The dice examples in Cartoon Guide for Statistics (at least one roll
of 6s) is one example that's worked out in full.  A good online lecture working
out an example of this problem is availabe here:
\url{http://www.youtube.com/watch?v=dwjQaJ5xt1o}.
~\\
~\\
@@ Lab rewrite quesiton:  Work through the example of the problem in the above
video, with a per-year flood probability of 0.01 (``100 year flood'') and 10
years.  Find the probability of at least one flood in 10 years.   Explain the
assumptions that you made to arrive at this answer.
~\\
~\\
Here, there are two extra steps. We need to find the probability of matching a
primer once, and the number of possible positions for that match.  
~\\
~\\
From Q4, we know that the sample space of a primer of length N is
\boldmath{$4^N$}.  Thus, given a single specific primer, the probability of
matching is \boldmath{$1/(4^N)$}.  We want to know the probability of {\em not}
matching, which is simply \boldmath{$1 - 1/(4^N)$}.
~\\
~\\
Next, we need to know the number of possible positions the primer can match the
sequence.  Obviously, a primer of length 1 can match any of the 12,000 bases,
and a primer of length 12,000 can only match in one possible location.  But
there are two possible places that a primer of length (12,000-1) can fit.  The
general equation for a sequence of length S and a primer of length N is (S-N+1) 
possible positions.
~\\
~\\
Thus, the probability of {\em no} matches is:
~\\
\boldmath{$(1- Pr(hit))^{tries} \\ =  (1 - (1/4)^N)^{(S-N+1)} $}
~\\
~\\
and the probability of \boldmath{$\ge 1$} matches
~\\
= 1 - Pr(no matches)
~\\
\boldmath{$= 1 - ( 1 - (1/4)^N)^{(S-N+1)} $}
}

\begin{enumerate}
    \item 1
\hfill \boldmath{$= 1 - ( 1 - (1/4)^1)^{12e3}  \sim 0$}
    \item 2
\hfill \boldmath{$= 1 - ( 1 - (1/4)^2)^{11,999}  \sim 0$}
    \item 5
\hfill \boldmath{$= 1 - ( 1 - (1/4)^5)^{11,995}  \sim 0$}
    \item 10
\hfill \boldmath{$= 1 - ( 1 - (1/4)^{10})^{11,990}  \sim 0?$}
    \item 20
\hfill \boldmath{$= 1 - ( 1 - (1/4)^{20})^{11,980}  \sim 0?$}
    \item 100
\hfill \boldmath{$= 1 - ( 1 - (1/4)^{100})^{11,900}  \sim 0?$}
\end{enumerate}
 
\end{document}
